package com.feng.study.demo.enum1;

import com.feng.study.enum1.Season;

public class EnumDemo {

    public static void main(String[] args) {
        Season spring = Season.SPRING;

        for (Season value : Season.values()) {
            System.out.println(value);
            //.name()和.ordinal()两个取值一样
            System.out.println(value.name());
            System.out.println(value.toString());
            System.out.println(value.ordinal());
        }
        System.out.println("=====================");
        System.out.println(Season.valueOf("SPRING"));
        System.out.println("=====================");
        //.compareTO()
        if (spring.compareTo(Season.SPRING)==0) {
            System.out.println("值相等");
        }
        System.out.println(spring.compareTo(Season.AUTUMN));
    }
}
